using System;

namespace ColladaDotNet.SimpleMesh
{
	public struct VertexBone : IEquatable<VertexBone>
	{
		public ulong Index;

		public double Weight;

		/// <summary>
		/// Indicates whether the current object is equal to another object of the same type.
		/// </summary>
		/// <returns>
		/// true if the current object is equal to the other parameter; otherwise, false.
		/// </returns>
		/// <param name="other">An object to compare with this object.</param>
		public bool Equals(VertexBone other)
		{
			return other.Index == Index && other.Weight == Weight;
		}

		/// <summary>
		/// Indicates whether this instance and a specified object are equal.
		/// </summary>
		/// <returns>
		/// true if obj and this instance are the same type and represent the same value; otherwise, false.
		/// </returns>
		/// <param name="obj">Another object to compare to. </param><filterpriority>2</filterpriority>
		public override bool Equals(object obj)
		{
			if (obj.GetType() != typeof(VertexBone))
			{
				return false;
			}
			return Equals((VertexBone)obj);
		}

		/// <summary>
		/// Returns the hash code for this instance.
		/// </summary>
		/// <returns>
		/// A 32-bit signed integer that is the hash code for this instance.
		/// </returns>
		/// <filterpriority>2</filterpriority>
		public override int GetHashCode()
		{
			unchecked
			{
				return ((int)Index * 397) ^ Weight.GetHashCode();
			}
		}

		public static bool operator ==(VertexBone left, VertexBone right)
		{
			return left.Equals(right);
		}

		public static bool operator !=(VertexBone left, VertexBone right)
		{
			return !left.Equals(right);
		}
	}
}